package com.oa.hyperion.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.oa.hyperion.entity.assets.AssetsGeneralLedger;
import com.oa.hyperion.repository.assets.AssetsGeneralLedgerMapper;
import com.oa.hyperion.service.AssetsGeneralLedgerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AssetsGeneralLedgerServiceImpl implements AssetsGeneralLedgerService {
    @Autowired
    private AssetsGeneralLedgerMapper assetsGeneralLedgerMapper;


    @Override
    public List<AssetsGeneralLedger> getAllAssets() {
        return assetsGeneralLedgerMapper.getAllAssets();
    }

    @Override
    public List<AssetsGeneralLedger> selectAssets(AssetsGeneralLedger assets) {
        return assetsGeneralLedgerMapper.selectAssets(assets);
    }

    @Override
    public AssetsGeneralLedger getAssetsById(int id) {
        return assetsGeneralLedgerMapper.getAssetsById(id);
    }

    @Override
    public AssetsGeneralLedger getAssetsByBarCode(String barCode){
        return assetsGeneralLedgerMapper.getAssetsByBarCode(barCode);
    }

    @Override
    public List<AssetsGeneralLedger> getAssetsByTypeAndStatus(int type,int status) {
        return assetsGeneralLedgerMapper.getAssetsByTypeAndStatus(type,status);
    }

    @Override
    public boolean insert(AssetsGeneralLedger assets) {
        return assetsGeneralLedgerMapper.insert(assets);
    }

    @Override
    public boolean update(AssetsGeneralLedger assets) {
        return assetsGeneralLedgerMapper.update(assets);
    }

    @Override
    public PageInfo<AssetsGeneralLedger> getByCondition(int pageNum,int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<AssetsGeneralLedger> assets = assetsGeneralLedgerMapper.getAllAssets();
        return new PageInfo<>(assets);
    }
}
